package com.algorithm.priority;/*
 *@Author:DOWN
 *@Date:2022/2/23 15:39
 *@Comment:
 */

import com.algorithm.heap.MaxHeap;
import com.algorithm.queue.QueueInterface;

public class HeapRealizePriority<E extends Comparable<E>> implements QueueInterface<E> {
    private MaxHeap<E> maxHeap;

    public HeapRealizePriority() {
        maxHeap = new MaxHeap<>();
    }

    @Override
    public int getSize() {
        return maxHeap.getSize();
    }

    @Override
    public boolean isEmpty() {
        return maxHeap.isEmpty();
    }

    @Override
    public void enqueue(E e) {
        maxHeap.add(e);
    }

    @Override
    public E dequeue() {
        return maxHeap.extractMax();
    }

    @Override
    public E getFront() {
        return maxHeap.findMax();
    }


}
